from typing import Optional

from pydantic import BaseModel

from models.user_models import Gender

from schemas.user_schemas import UserCreate,UserUpdate

#病人创建请求模型
class PatientCreate(UserCreate):

    phone_number: str



    def check(self):

        super().check()
        if not 0<len(self.phone_number)<20:
            raise ValueError("Phone number must be between 0 and 20.")


#病人更新请求模型
class PatientUpdate(UserUpdate):

    phone_number: Optional[str] = None

    def check(self):
        super().check()
        if self.phone_number is not None and not 0 < len(self.phone_number) < 20:
            raise ValueError("Phone number must be between 0 and 20.")

